| Conditions | 1 |
| Total Lines | 10 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import I18n from '@ioc:Adonis/Addons/I18n' |
||
| 16 | /** |
||
| 17 | * Detect user language using "Accept-language" header or |
||
| 18 | * the "lang" query string parameter. |
||
| 19 | * |
||
| 20 | * The user language must be part of the "supportedLocales", otherwise |
||
| 21 | * this method should return null. |
||
| 22 | */ |
||
| 23 | protected getUserLanguage(ctx: HttpContextContract) { |
||
| 24 | const availableLocales = I18n.supportedLocales() |
||
| 25 | return ctx.request.language(availableLocales) || ctx.request.input('lang') |
||
| 26 | } |
||
| 53 |